/**
 * 静态页面获取url参数
 */
import React, { Component } from 'react';
import { withRouter } from 'next/router';


@withRouter
class Comp extends Component {
  componentDidMount = () => {
    console.log(this.props)
  };
  render() {
    const { id } = this.props
    return (
      <div>
         getInitialProps page {id}
      </div>
    );
  }
}

// 每次请求时候运行 （服务端渲染）
export async function getStaticProps(ctx) {
  const { id } = ctx.params
  console.log('getStaticProps')
  return {
      props: { id }
  }
}

export async function getStaticPaths() {
  return {
      paths: [],
      fallback: 'blocking'
  }
}


export default Comp